package com.example.evanproject.controller;
import com.example.evanproject.domain.Coursechapter;
import com.example.evanproject.service.impl.CoursechapterServiceImpl;
import com.example.evanproject.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/courseinfo")
public class CourseChapterController {
    @Autowired
    private CoursechapterServiceImpl courseChapterService;

    @RequestMapping("getallinfo")
    public AjaxResult selecttest(Integer fid){

        return AjaxResult.success(courseChapterService.selectcourseallinfo(fid)) ;
    }
    @RequestMapping("getallinfoByUserId")
    public AjaxResult getallinfoByUserId(Integer fid,String userId){

        return AjaxResult.success(courseChapterService.getallinfoByUserId(fid,userId)) ;
    }


    /*创建章节*/
    @RequestMapping("/addCourseChapter")

    /*传的参数为(fId,scName)*/
    public AjaxResult addCourseChapter(Coursechapter courseChapter){
        Integer num=courseChapterService.addCourseChapter(courseChapter);
        System.out.println(num);
        return AjaxResult.success(num);
    }

}
